package com.byb.server.domain;

import io.swagger.annotations.ApiModel;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 重疾表
 */
@ApiModel(description = "重疾表")
@Entity
@Table(name = "strichen")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "strichen")
public class Strichen implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "strichen_name")
    private String strichenName;

    @ManyToOne
    private Product product;

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getStrichenName() {
        return strichenName;
    }

    public Strichen strichenName(String strichenName) {
        this.strichenName = strichenName;
        return this;
    }

    public void setStrichenName(String strichenName) {
        this.strichenName = strichenName;
    }

    public Product getProduct() {
        return product;
    }

    public Strichen product(Product product) {
        this.product = product;
        return this;
    }

    public void setProduct(Product product) {
        this.product = product;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Strichen strichen = (Strichen) o;
        if (strichen.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), strichen.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "Strichen{" +
            "id=" + getId() +
            ", strichenName='" + getStrichenName() + "'" +
            "}";
    }
}
